﻿using BaiTu.CachingEntity;
using BaiTu.CachingServices.Configuration;
using BaiTu.CachingServices.Helpers;
using BaiTu.ICachingServices;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BaiTu.CachingServices.CacheProvider
{
    class RedisCacheProvider : ICacheProvider
    {
        private CacheServerInfo configInfo; 
        public RedisCacheProvider(CacheServerInfo configInfo)
        {
            this.configInfo = configInfo;
        }
        public void Put(string key, object value, CacheExpireType expireType, double increment)
        {
            BaiTu.RedisExecutors.RedisExecutor.Add(key, value, TimeHelper.CalculateExpirationDateTime(expireType, increment));
        }

        public object Get(string key)
        {
            return BaiTu.RedisExecutors.RedisExecutor.GetValue(key);
        }

        public void Remove(string key)
        {
            BaiTu.RedisExecutors.RedisExecutor.Remove(key);
        }
    }
}
